import request from '@/utils/request'

export function getList(limit, page, search_word, material_type) {
  return request({
    url: '/api/material/material_fuzzy_search',
    method: 'get',
    params: {
      limit,
      page,
      search_word,
      material_type
    }
  })
}
export function getUnits() {
  return request({
    url: '/api/material/basic_measure_unit_list',
    method: 'get'
  })
}
export function add(data) {
  return request({
    url: '/api/material/material_add',
    method: 'post',
    data: {
      code: data.code,
      name: data.name,
      spec: data.spec,
      alias: data.alias,
      basic_measure_unit: data.value2
    }
  })
}
export function deleteMaterial(ids) {
  return request({
    url: '/api/material/material_del',
    method: 'post',
    data: {
      ids
    }
  })
}
export function edit(data) {
  return request({
    url: '/api/material/material_edit',
    method: 'post',
    data: {
      id: data.id,
      code: data.code,
      name: data.name,
      spec: data.spec,
      alias: data.alias,
      basic_measure_unit: data.value2
    }
  })
}
